<?php
//后台分页
function Page($scalar, $pNum, $pid) {
	$pageList = "<table class=\"bottomline\" width=\"100%\" border=\"0\"><tr>
            <td nowrap>共 $scalar 条记录<input type=\"hidden\" name=\"recordCount\" value=\"$scalar\" /></td>
            <td nowrap>共 $pNum 页<input type=\"hidden\" name=\"pageCount\" id=\"pageCount\" value=\"$pNum\" /></td>
            <td nowrap align=\"center\">去第<input type=\"text\" name=\"pageNo\"  id=\"pageNo\" size=\"6\" maxlength=\"6\" value=\"$pid\" class=\"textfield\" onKeyUp=\"submitForm();\" />页</td>
            <td nowrap align=\"right\">";
	if ($pid == 1) {
		$pageList .= "<img src=\"/images/admin/arrow_fst.gif\" border=\"0\"/> ";
		$pageList .= "<img src=\"/images/admin/arrow_pre.gif\" border=\"0\"/> ";
	} else {
		
		$pageList .= "<a href=\"javascript:toFirst()\"><img src=\"/images/admin/arrow_fst_a.gif\" border=\"0\"/></a> ";
		$pageList .= "<a href=\"javascript:toPrior()\"><img src=\"/images/admin/arrow_pre_a.gif\" border=\"0\"/></a> ";
	}
	if ($pid < $pNum) {
		$pageList .= "<a href=\"javascript:toNext()\"><img src=\"/images/admin/arrow_nxt_a.gif\" border=\"0\"/></a> ";
		$pageList .= "<a href=\"javascript:toLast()\"><img src=\"/images/admin/arrow_lst_a.gif\" border=\"0\"/></a> ";
	} else {
		$pageList .= "<img src=\"/images/admin/arrow_nxt.gif\" border=\"0\"/> ";
		$pageList .= "<img src=\"/images/admin/arrow_lst.gif\" border=\"0\"/> ";
	}
	$pageList .= "</td></tr></table>";
	return $pageList;
}
function htmtocode($content){
		$content=str_replace("\n","<br>",str_replace(" ","&nbsp;",$content));
		return $content;
	}



function getPnum($scalar, $psize) {
	if (($scalar % $psize) == 0) {
		$pNum = $scalar / $psize;
	} else {
		$pNum = ceil ( $scalar / $psize );
	}
	return $pNum;
}
function PromptMessage($msg = '', $isRet = false, $url = '', $isExit = true, $back = false) {
	echo (chr ( 239 ) . chr ( 187 ) . chr ( 191 ));
	if ($isRet == TRUE) {
		$rtStr = ' window.returnValue="T"; window.close();';
	} else {
		$rtStr = '';
		if ($url != '') {
			$url = base_url () . "index.php/" . $url;
			$rtStr = "location.href=\"$url\";";
		}elseif($back) {
			$rtStr = 'location.href="'.$_SERVER['HTTP_REFERER'].'";';
		}
	}
	echo '<script language="JavaScript">';
	if ($msg != '') {
		echo 'alert("' . $msg . '");';
	}
	echo $rtStr;
	echo '</script>';
	if($isExit) exit ();
}
function PromptMessage1($msg = '', $isRet = false, $url = '', $isExit = true, $back = false) {
	echo (chr ( 239 ) . chr ( 187 ) . chr ( 191 ));
	if ($isRet == TRUE) {
		$rtStr = ' window.returnValue="T"; window.close();';
	} else {
		$rtStr = '';
		if ($url != '') {
			$url = base_url ()  . $url;
			$rtStr = "location.href=\"$url\";";
		}elseif($back) {
			$rtStr = 'location.href="'.$_SERVER['HTTP_REFERER'].'";';
		}
	}
	echo '<script language="JavaScript">';
	if ($msg != '') {
		echo 'alert("' . $msg . '");';
	}
	echo $rtStr;
	echo '</script>';
	if($isExit) exit ();
}
function PromptMessagemy($msg = '', $isRet = false, $url = '', $isExit = true, $back = false) {
	echo (chr ( 239 ) . chr ( 187 ) . chr ( 191 ));
	if ($isRet == TRUE) {
		$rtStr = ' window.returnValue="T"; window.close();';
	} else {
		$rtStr = '';
		if ($url != '') {
			$url = $url;
			$rtStr = "location.href=\"$url\";";
		}elseif($back) {
			$rtStr = 'location.href="'.$_SERVER['HTTP_REFERER'].'";';
		}
	}
	echo '<script language="JavaScript">';
	if ($msg != '') {
		echo 'alert("' . $msg . '");';
	}
	echo $rtStr;
	echo '</script>';
	if($isExit) exit ();
}
//跳转回当前页面
function PromptMessageUrl($msg = '', $isRet = FALSE, $url = '', $isExit=true) {
	echo (chr ( 239 ) . chr ( 187 ) . chr ( 191 ));
	if ($isRet == TRUE) {
		$rtStr = ' window.returnValue="T"; window.close();';
	} else {
		$rtStr = '';
		if ($url != '') {
			//$url = base_url () . "index.php/" . $url;
			$rtStr = "location.href=\"$url\";";
		}
	}
	echo '<script language="JavaScript">';
	if ($msg != '') {
		echo 'alert("' . $msg . '");';
	}
	echo $rtStr;
	echo '</script>';
	if($isExit) exit ();
}
function UploadPath($dir,$chengshi) {
	//判断创建新的目录
	define ( 'ROOT_PATH', str_replace ( 'application/helpers/MY_form_helper.php', '', str_replace ( '\\', '/', __FILE__ ) ) );
	$dir = ROOT_PATH . 'uploads/' . $dir . '/';
	$dir1 = date ( "Y", time () );
	$dir2 = date ( "m", time () );
	$dir3 = $chengshi;
	if (! file_exists ( $dir . $dir3 )) {
		@mkdir ( $dir . $dir3 . "/", 0777 );
	}
	if (! file_exists ( $dir . $dir3 . "/" . $dir1 )) {
		@mkdir ( $dir . $dir3 . "/" . $dir1 . "/", 0777 );
	}
	if (! file_exists ( $dir . $dir3 . "/" . $dir1. "/" . $dir2 )) {
		@mkdir ( $dir . $dir3 . "/" . $dir1 . "/". $dir2 . "/", 0777 );
	}
	//echo $dir.''.$dir1."/".$dir2; exit;
	return $dir . '' . $dir3 . "/" . $dir1 .  "/" . $dir2;
}
function UploadPath2($dir) {
	//判断创建新的目录
	define ( 'ROOT_PATH', str_replace ( 'application/helpers/My_form_helper.php', '', str_replace ( '\\', '/', __FILE__ ) ) );
	$dir = ROOT_PATH . 'uploads/' . $dir . '/';
	$dir1 = date ( "Y", time () );
	$dir2 = date ( "m", time () );
	if (! file_exists ( $dir  )) {
		@mkdir ( $dir, 0777 );
	}
	if (! file_exists ( $dir  . "/" . $dir1 )) {
		@mkdir ( $dir . "/" . $dir1 . "/", 0777 );
	}
	if (! file_exists ( $dir . "/" . $dir1. "/" . $dir2 )) {
		@mkdir ( $dir . "/" . $dir1 . "/". $dir2 . "/", 0777 );
	}
	//echo $dir.''.$dir1."/".$dir2; exit;
	return $dir . $dir1 .  "/" . $dir2;
}
function UploadPath1($dir,$chengshi,$quyu,$shangquan) {
	//判断创建新的目录
	define ( 'ROOT_PATH', str_replace ( 'application/helpers/MY_form_helper.php', '', str_replace ( '\\', '/', __FILE__ ) ) );
	$dir = ROOT_PATH . 'uploads/' . $dir . '/';
	$dir1 = $chengshi;
	$dir2 = $quyu;
	$dir3 = $shangquan;
	if (! file_exists ( $dir . $dir1 )) {
		@mkdir ( $dir . $dir1 . "/", 0777 );
	}
	if (! file_exists ( $dir . $dir1 . "/" . $dir2 )) {
		@mkdir ( $dir . $dir1 . "/" . $dir2 . "/", 0777 );
	}
	if (! file_exists ( $dir . $dir1 . "/" . $dir2 ."/" . $dir3 )) {
		@mkdir ( $dir . $dir1 . "/" . $dir2 . "/" .$dir3 . "/", 0777 );
	}
	//echo $dir.''.$dir1."/".$dir2; exit;
	return $dir . '' . $dir1 . "/" . $dir2 ."/" . $dir3;
}
function UploadPath11($dir,$chengshi,$name) {
	//判断创建新的目录
	define ( 'ROOT_PATH', str_replace ( 'application/helpers/MY_form_helper.php', '', str_replace ( '\\', '/', __FILE__ ) ) );
	$dir = ROOT_PATH . 'uploads/' . $dir . '/';
	$dir1 = $chengshi;
	$dir2 = $name;
	if (! file_exists ( $dir . $dir1 )) {
		@mkdir ( $dir . $dir1 . "/", 0777 );
	}
	if (! file_exists ( $dir . $dir1 . "/" . $dir2 )) {
		@mkdir ( $dir . $dir1 . "/" . $dir2 . "/", 0777 );
	}
	//echo $dir.''.$dir1."/".$dir2; exit;
	return $dir . '' . $dir1 . "/" . $dir2 ;
}
//删除文件
function del_file($fname) {
	$filename = $_SERVER ['DOCUMENT_ROOT'] . '/uploads/' . $fname; //获得服务器文档根变量
	if (file_exists ( $filename )) {
		unlink ( $filename );
	}
}
/**
 * 检查商家是否登录系统
 *
 * 1、用户性质 $type 1.个人 2. 商家
 * 2、登录状态 USER_LOGIN
 *
 * @return boolean
 */
function isLogin($type) {
	if ($type == 2) {
		if (! empty ( $_SESSION ['business_id'] )) {
			return true;
		}
	} elseif ($type == 1) {
		if (! empty ( $_SESSION ['users_id'] ) ) {
			return true;
		}
	} else {
		return false;
	}
}

/**
 *   截取中英文部分字符串
 *
 *   截取指定字符串指定长度的函数,该函数可自动判定中英文,不会出现乱码
 *
 *   @access   public
 *   @param   string         $string    要处理的字符串
 *   @param   int            $sublen    要截取的长度
 *   @param   int            $start     开始位置
 *   @param   string         $code      传入编码
 *   @return   string
 */
function cutStr($string, $sublen, $start = 0, $code = 'UTF-8') {
	if ($code == 'UTF-8') {
		$pa = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/";
		preg_match_all ( $pa, $string, $t_string );
		if (count ( $t_string [0] ) - $start > $sublen)
		return join ( '', array_slice ( $t_string [0], $start, $sublen ) ) . " ";
		return join ( '', array_slice ( $t_string [0], $start, $sublen ) );
	} else {
		$start = $start * 2;
		$sublen = $sublen * 2;
		$strlen = strlen ( $string );
		$tmpstr = '';
		for($i = 0; $i < $strlen; $i ++) {
			if ($i >= $start && $i < ($start + $sublen)) {
				if (ord ( substr ( $string, $i, 1 ) ) > 129) {
					$tmpstr .= substr ( $string, $i, 2 );
				} else {
					$tmpstr .= substr ( $string, $i, 1 );
				}
			}
			if (ord ( substr ( $string, $i, 1 ) ) > 129)
			$i ++;
		}
		if (strlen ( $tmpstr ) < $strlen)
		$tmpstr .= " ";
		return $tmpstr;
	}
}
//截字多了加....
function cutStr_yang($string, $sublen, $start = 0, $code = 'UTF-8') {
	if ($code == 'UTF-8') {
		$pa = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/";
		preg_match_all ( $pa, $string, $t_string );
		if (count ( $t_string [0] ) - $start > $sublen)
		return join ( '', array_slice ( $t_string [0], $start, $sublen ) ) . "...";
		return join ( '', array_slice ( $t_string [0], $start, $sublen ) );
	} else {
		$start = $start * 2;
		$sublen = $sublen * 2;
		$strlen = strlen ( $string );
		$tmpstr = '';
		for($i = 0; $i < $strlen; $i ++) {
			if ($i >= $start && $i < ($start + $sublen)) {
				if (ord ( substr ( $string, $i, 1 ) ) > 129) {
					$tmpstr .= substr ( $string, $i, 2 );
				} else {
					$tmpstr .= substr ( $string, $i, 1 );
				}
			}
			if (ord ( substr ( $string, $i, 1 ) ) > 129)
			$i ++;
		}
		if (strlen ( $tmpstr ) < $strlen)
		$tmpstr .= "...";
		return $tmpstr;
	}
}
function dtime($t1, $t2) {
	$t1 = strtotime($t1);
	$t2 = strtotime($t2);
	$t12 = abs($t1-$t2);
	$start = 0;
	//$string = "两个时间相差：";
	$y = floor($t12/(3600*24*360));
	if($start || $y )
	{
		$start = 1;
		$t12 -= $y*3600*24*360;
		$string .= $y."年";
	}
	$m = floor($t12/(3600*24*31));
	if($start || $m)
	{
		$start = 1;
		$t12 -= $m*3600*24*31;
		$string .= $m."月";
	}
	$d = floor($t12/(3600*24));
	if($start || $d)
	{
		$start = 1;
		$t12 -= $d*3600*24;
		$string .= $d."天";
	}
	$h = floor($t12/(3600));
	if($start || $h)
	{
		$start = 1;
		$t12 -= $h*3600;
		$string .= $h."小时";
	}
	$s = floor($t12/(60));
	if($start || $s)
	{
		$start = 1;
		$t12 -= $s*60;
		$string .= $s."分钟";
	}
	//$string .= "{$t12}秒";
	return $string;
}
function utf8_substr($str, $position, $length) {
	$start_position = strlen ( $str );
	$start_byte = 0;
	$end_position = strlen ( $str );
	$count = 0;
	for($i = 0; $i < strlen ( $str ); $i ++) {
		if ($count >= $position && $start_position > $i) {
			$start_position = $i;
			$start_byte = $count;
		}
		if (($count - $start_byte) >= $length) {
			$end_position = $i;
			break;
		}
		$value = ord ( $str [$i] );
		if ($value > 127) {
			$count ++;
			if ($value >= 192 && $value <= 223)
			$i ++;
			elseif ($value >= 224 && $value <= 239)
			$i = $i + 2;
			elseif ($value >= 240 && $value <= 247)
			$i = $i + 3;
			else
			die ( 'Not a UTF-8 compatible string' );
		}
		$count ++;

	}
	return (substr ( $str, $start_position, $end_position - $start_position ));
}
//关键字过滤
if ( ! function_exists('clean')) {
	function clean($string) {
		//请自行增减此数组内容，以达到最好过滤效果
		$sql="SELECT * FROM web_sensitive_words  WHERE 1";
		$query=@mysql_query($sql);
		while($drr=@mysql_fetch_array($query)){
			$keywords[trim($drr['words'])]='***';
		}	//print_r($keywords);exit;
		return strtr($string, $keywords);
	}
}

//关键字过滤数组
if ( ! function_exists('clean_array')) {
	function clean_array($array) {
		foreach ($array as $key=>$values){
			$new_array[$key]=clean($values);
		}
		return $new_array;
	}
}


//防止sql注入
function htmlfilter($str)
{
	if(empty($str)) return;
	if($str=="") return $str;
	$str=str_replace("&","&amp;",$str);
	$str=str_replace(">","&gt;",$str);
	$str=str_replace("<","&lt;",$str);
	$str=str_replace(chr(32),"&nbsp;",$str);
	$str=str_replace(chr(9),"&nbsp;",$str);
	$str=str_replace(chr(34),"&",$str);
	$str=str_replace(chr(39),"&#39;",$str);
	$str=str_replace(chr(13),"<br />",$str);
	$str=str_replace("'","''",$str);
	$str=str_replace("select","select_",$str);
	$str=str_replace("join","join_",$str);
	$str=str_replace("union","union_",$str);
	$str=str_replace("where","where_",$str);
	$str=str_replace("insert","insert_",$str);
	$str=str_replace("delete","delete_",$str);
	$str=str_replace("update","update_",$str);
	$str=str_replace("like","like_",$str);
	$str=str_replace("drop","drop_",$str);
	$str=str_replace("create","create_",$str);
	$str=str_replace("or","or_",$str);
	return $str;
}
//缩略图路径调用
function getSmallPic($pic_id) {
	$index = strripos($pic_id, '/');
	$file_path = substr($pic_id, 0, $index + 1);
	$file_name = substr($pic_id, $index + 1);

	return $file_path . 's_' . $file_name;
}
//商家缩略图路径调用
function getbusismallpic($pic_id) {
	$pic_id_1=explode(".",$pic_id);
	$pic_id_new=$pic_id_1[0].'_thumb.'.$pic_id_1[1];
	return $pic_id_new;
}
//html处理
function filterHtmlTag($src, $length=0) {
	$reg = '/';
	$reg .= '<p.*?>';
	$reg .= '|<span.*?>';
	$reg .= '|<font.*?>';
	$reg .= '|<div.*?>';
	$reg .= '|<a.*?>';
	$reg .= '|<img.*?>';
	$reg .= '|<br.*?>';
	$reg .= '|<\/p.*?>';
	$reg .= '|<\/span.*?>';
	$reg .= '|<\/font.*?>';
	$reg .= '|<\/div.*?>';
	$reg .= '|<\/a.*?>';
	$reg .= '|<\/img.*?>';
	$reg .= '|<\/br.*?>';
	$reg .= '|&nbsp;';
	$reg .= '/i';

	$src = preg_replace($reg, '', $src);

	if ($length > 0) {
		$src = mb_substr($src, 0, $length, 'utf-8');
	}

	return $src;
}
function parseurl($url="")
{
	$url = rawurlencode(mb_convert_encoding($url, 'gb2312', 'utf-8'));
	$a = array("%3A", "%2F", "%40");
	$b = array(":", "/", "@");
	$url = str_replace($a, $b, $url);
	return $url;
}
//php把时间计算成几分钟前，几小时前，几天前的函数
function time_tran($the_time) {
	$now_time = date ( "Y-m-d H:i:s");
	//echo $now_time."now_time<br>";
	$now_time = strtotime ( $now_time );
	//echo $now_time."now_time<br>";
	//echo $the_time."the_time<br>";
	$show_time = strtotime ( $the_time );
	//echo $show_time."the_time<br>";
	$dur = $now_time - $show_time;
	//echo $dur."dur<br>";
	if ($dur < 0) {
		return $the_time;
	} else {
		if ($dur < 60) {
			return $dur . '秒前';
			//return '1分钟前';
		} else {
			if ($dur < 3600) {
				return floor ( $dur / 60 ) . '分钟前';
			} else {
				if ($dur < 86400) {
					return floor ( $dur / 3600 ) . '小时前';
				} else {
					if ($dur < 2592000) { //30天内
						return floor ( $dur / 86400 ) . '天前';
					} else {
						return '1个月前';
					}
				}
			}
		}
	}
}
function time_tran1($the_time) {
	$now_time = date ( "Y-m-d H:i:s");
	//echo $now_time."now_time<br>";
	$now_time = strtotime ( $now_time );
	//echo $now_time."now_time<br>";
	//echo $the_time."the_time<br>";
	$show_time = strtotime ( $the_time );
	//echo $show_time."the_time<br>";
	$dur = $now_time - $show_time;
	//echo $dur."dur<br>";
	$the_time = cutStr( $the_time,10 );
	$arr = explode('-',$the_time);
	$the_time = $arr[1].'月'.$arr[2].'日';
	if ($dur < 0) {
		return $the_time;
	} else {
		if ($dur < 60) {
			return '1分钟';
			//return '1分钟前';
		} else {
			if ($dur < 3600) {
				return floor ( $dur / 60 ) . '分钟';
			} else {
				if ($dur < 86400) {
					return floor ( $dur / 3600 ) . '小时';
				} else {
					if ($dur >86400) { //30天内
						return $the_time ;
					}
				}
			}
		}
	}
}
//数组打乱
function ass_array_shuffle ($array) {
	while (count($array) > 0) {
		$val = array_rand($array);
		$new_arr[$val] = $array[$val];
		unset($array[$val]);
	}
	return $new_arr;
}
//加亮
function menu_hover($menu, $cur) {
	if ($menu == $cur) {
		return 'class="over"';
	}
}
//缩略图路径调用
function get_thumb_pic($pic_id,$thumb) {
	$pic_id_1=explode(".",$pic_id);
	if($pic_id_1[0]){
		$pic_id_new=$pic_id_1[0].'_'.$thumb.'.'.$pic_id_1[1];
	}else{
		if($thumb=='s'){
			$pic_id_new = 'listnone.gif';
		}elseif($thumb=='m'){
			$pic_id_new = 'no_product_pic_115X129.gif';
		}elseif($thumb=='b'){
			$pic_id_new = 'no_product_pic_600X383.gif';
		}
	}
	return $pic_id_new;
}

function get_thumb_pic1($pic_id,$thumb) {
	$pic_id_1=explode(".",$pic_id);
	if($thumb){
		$pic_id_new=$pic_id_1[0].'_'.$thumb.'.'.$pic_id_1[1];
	}else{
		$pic_id_new=$pic_id_1[0].'.'.$pic_id_1[1];
	}

	return $pic_id_new;
}
/*缩略图临时路径处理
 * D:\APMServ5.2.6\tmp\uploadtemp\php4F3.tmp 怎么处理可以变成 D:\APMServ5.2.6\tmp\uploadtemp\php4F3_b.tmp
 */
//linux
function get_thumb_tmp($pic_id, $thumb) {
	if(PATH_SEPARATOR==':'){
		if ($pic_id) {
			$pic_id_new = $pic_id . '_' . $thumb;
		}
	}else{
		$pic_id_1 = explode ( ".tmp", $pic_id );
		if ($pic_id_1 [0]) {
			$pic_id_new = $pic_id_1 [0] . '_' . $thumb . '.tmp';
		}
	}
	return $pic_id_new;
}
//返回图片缩图
function get_small_pic($pic_id, $thumb) {
	if ($pic_id) {
		$pic_id_1 = explode ( ".", $pic_id );
		$pic_id_new = $pic_id_1 [0] . '_' . $thumb . '.' . $pic_id_1 [1];
	}
	return $pic_id_new;
}
//返回文件类型
function get_thumb_tpye($pic_id) {
	$pic_id_1 = explode ( ".", $pic_id );
	if ($pic_id_1 [0]) {
		$pic_id_new = $pic_id_1 [1];
	}else
	$pic_id_new = 'jpg';
	return strtolower( $pic_id_new );
}
//根据图片地址返回图片大小
function get_image_size($path) {
	$arr = getimagesize ( $path );
	return $arr [3];
}
//根据图片地址返回图片大小 width $a=1  height  $a=3
function get_image_size_yang($path,$a) {
	$arr = getimagesize ( $path );
	$strarr=explode("\"" ,$arr[3]);
	return($strarr[$a]);
}
/*
 * 数字返回末尾2位
 * 9 返回09
 * 100返回00
 * 123返回23
 *
 */
function get_num_end($id) {
	$str   =   intval($id);
	$str2 = substr($str,-2);
	if(strlen($str) == 1){
		$str2 = '0'.$str;
	}
	return $str2;
}
/**********************************常用的class类开始*********************************************************/
/*
 返回类型：boolean
 参数类型：String $email
 描述：简单检查Email是否合法
 作者：hhb<hello_hhb@21cn.com>
 */
function isValidEmail($email) {
	$email_regex = "^([-!#\$%&'*+./0-9=?A-Z^_`a-z{|}~ ])+@([-!#\$%&'*+/0-9=?A-Z^_`a-z{|}~ ]+\\.)+[a-zA-Z]{2,6}\$";
	if ($email != "") {
		return eregi ( $email_regex, $email );
	} else {
		return false;
	}
}
//检查邮件格式
function CheckEmail($email)
{
	//if(!ereg("^[_a-zA-Z0-9\-\.]+[_a-zA-Z0-9\-]+@[_a-zA-Z0-9\-]+[_a-zA-Z0-9\.\-]+(\.[_a-zA-Z0-9\.\-])+[a-zA-Z0-9]{1,3}",$email))
	if(!ereg("^[-a-zA-Z0-9_\.]+\@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{1,3}$",$email))
	{
		return false;
	}else{
		return true;
	}
}

//检查是否为手机(必须是13开头，且为11位数字)（房屋专用）
function CheckMobile($Mobile)
{
	return (preg_match('/^13/', $Mobile) && preg_match('/[0-9]{11}/', $Mobile) && (strlen($Mobile)==11)) ? true : false;
}

//检查是否为固定电话(最多为8位，且全为数字)（房屋专用）
function CheckTel($Tel)
{
	return (preg_match('/[0-9]{8}/', $Tel) && (strlen($Tel)<=8)) ? true : false;
}
//把数字和英文的全角转化为半角
function f2a($Str)
{
	$Queue = Array('０' => '0', '１' => '1', '２' => '2', '３' => '3', '４' => '4', '５' => '5', '６' => '6', '７' => '7', '８' => '8', '９' => '9',
		'Ａ' => 'A', 'Ｂ' => 'B', 'Ｃ' => 'C', 'Ｄ' => 'D', 'Ｅ' => 'E', 'Ｆ' => 'F', 'Ｇ' => 'G', 'Ｈ' => 'H', 'Ｉ' => 'I', 'Ｊ' => 'J', 
		'Ｋ' => 'K', 'Ｌ' => 'L', 'Ｍ' => 'M', 'Ｎ' => 'N', 'Ｏ' => 'O', 'Ｐ' => 'P', 'Ｑ' => 'Q', 'Ｒ' => 'R', 'Ｓ' => 'S', 'Ｔ' => 'T', 
		'Ｕ' => 'U', 'Ｖ' => 'V', 'Ｗ' => 'W', 'Ｘ' => 'X', 'Ｙ' => 'Y', 'Ｚ' => 'Z', 'ａ' => 'a', 'ｂ' => 'b', 'ｃ' => 'c', 'ｄ' => 'd', 
		'ｅ' => 'e', 'ｆ' => 'f', 'ｇ' => 'g', 'ｈ' => 'h', 'ｉ' => 'i', 'ｊ' => 'j', 'ｋ' => 'k', 'ｌ' => 'l', 'ｍ' => 'm', 'ｎ' => 'n', 
		'ｏ' => 'o', 'ｐ' => 'p', 'ｑ' => 'q', 'ｒ' => 'r', 'ｓ' => 's', 'ｔ' => 't', 'ｕ' => 'u', 'ｖ' => 'v', 'ｗ' => 'w', 'ｘ' => 'x', 
		'ｙ' => 'y', 'ｚ' => 'z');

	return preg_replace("/([\xA3][\xB0-\xB9\xC1-\xDA\xE1-\xFA])/e", "\$Queue[\\1]", $Str);
}
function   get_time($DateTime1,   $DateTime2= " ",   $RetFormat= "S ")
{
	//如果$DateTime2为空，设置为当前的时间
	if   ($DateTime2   ==   " ")   $DateTime2   =   date( "Y-m-d   H:i:s ");
	//格式化时间
	$DateTimeTemp   =   strftime( "%Y-%m-%d   %H:%M:%S ",strtotime($DateTime1));//格式化字符串
	$iTemp[ "Y "]   =   intval(substr($DateTimeTemp,0,4));
	$iTemp[ "M "]   =   intval(substr($DateTimeTemp,5,2));
	$iTemp[ "D "]   =   intval(substr($DateTimeTemp,8,2));
	$iTemp[ "H "]   =   intval(substr($DateTimeTemp,11,2));
	$iTemp[ "I "]   =   intval(substr($DateTimeTemp,14,2));
	$iTemp[ "S "]   =   intval(substr($DateTimeTemp,17,2));
	$aDT[]   =   $iTemp;
	unset($iTemp);
	$DateTimeTemp   =   strftime( "%Y-%m-%d   %H:%M:%S ",strtotime($DateTime2));//格式化字符串
	$iTemp[ "Y "]   =   intval(substr($DateTimeTemp,0,4));
	$iTemp[ "M "]   =   intval(substr($DateTimeTemp,5,2));
	$iTemp[ "D "]   =   intval(substr($DateTimeTemp,8,2));
	$iTemp[ "H "]   =   intval(substr($DateTimeTemp,11,2));
	$iTemp[ "I "]   =   intval(substr($DateTimeTemp,14,2));
	$iTemp[ "S "]   =   intval(substr($DateTimeTemp,17,2));
	$aDT[]   =   $iTemp;
	//$DateTime2   -   $DateTime1的时间差值，单位秒
	$iSec   =   mktime($aDT[1][ "H "],   $aDT[1][ "I "],   $aDT[1][ "S "],
	$aDT[1][ "M "],   $aDT[1][ "D "],   $aDT[1][ "Y "])   -
	mktime($aDT[0][ "H "],   $aDT[0][ "I "],   $aDT[0][ "S "],
	$aDT[0][ "M "],   $aDT[0][ "D "],   $aDT[0][ "Y "]);

	//格式化输出值
	if   ($RetFormat   ==   "S ")
	return   $iSec;
	elseif   ($RetFormat   ==   "I ")
	return   $iSec   /   60;
	elseif   ($RetFormat   ==   "H ")
	return   $iSec   /   (60   *   60);
	elseif   ($RetFormat   ==   "D ")
	return   $iSec   /   (60   *   60   *   24);
}
/******************************************
 *函数：getRandomPassword($length = 8, $type = 'digit&&lower')
 *作用：得到一个随机密码
 *输入：
 *输出：得到一个8位的随机密码(小写字母加数字)
 *用法：调用类的函数
 **
 ******************************************
 *－－制作－－日期－－
 *KuaiYigang@xingmo.com  2005-6-18
 ******************************************
 *－－修改－－日期－－目的－－
 *
 */
function getRandomPassword($length = 8, $type = 'digit&&lower')
{
	$result = '';

	$char = array(
			'digit' => '0123456789',
			'lower' => 'abcdefghijklmnopqrstuvwxyz',
			'upper' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
			'punct' => '~`!@#$%^&*()_-+=|\\{[}]:;"\'<,>.?/'
			);

			$password = '';
			$param = explode('&&', $type);
			foreach($param as $value)
			{
				$password .= $char[$value];
			}

			$theLastKey = strlen($password) - 1;

			for($i = 0; $i < $length; $i++)
			{
				$result .= $password[rand(0, $theLastKey)];
			}

			return $result;
}
//将一个数组中的值转码
function xiconv($in_charset, $out_charset, $var)
{
	if(is_string($var))
	{
		return iconv($in_charset, $out_charset, $var);
	}
	elseif(is_array($var))
	{
		foreach($var as $key=>$val)
		{
			if(is_string($val))
			{
				$var[$key] =  iconv($in_charset, $out_charset, $val);
			}
			elseif(is_array($val))
			{
				foreach($val as $key2=>$val2)
				{
					if(is_string($val2))
					{
						$var[$key][$key2] =  iconv($in_charset, $out_charset, $val2);
					}
					else
					{
						return false;
					}
				}
			}
		}
		return $var;
	}
	else
	{
		return false;
	}
}
//得到一个随机字符串
function random($length, $numeric = 0)
{
	mt_srand((double)microtime() * 1000000);
	if($numeric)
	{
		$hash = sprintf('%0'.$length.'d', mt_rand(0, pow(10, $length) - 1));
	}
	else
	{
		$hash = '';
		$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
		$max = strlen($chars) - 1;
		for($i = 0; $i < $length; $i++)
		{
			$hash .= $chars[mt_rand(0, $max)];
		}
	}
	return $hash;
}
// UT*转GBK
function u2g($str){
	return iconv("UTF-8","GBK",$str);
}
// GBK转UTF8
function g2u($str){
	return iconv("GBK","UTF-8//ignore",$str);
}
//得到一个汉字的拼音的首字母（大写）
function getInitial($Word){
	$Word = u2g($Word);//转成GBK
	$ret="";
	$p=ord(substr($Word,0,1));
	if($p>160){
		$q=ord(substr($Word,1,1));
		$p=$p*256+$q;
	}

	$tmp = $p;

	if($tmp>=45217 && $tmp<=45252)
	$getpychar= "A";
	elseif($tmp>=45253 && $tmp<=45760)
	$getpychar= "B";
	elseif($tmp>=45761 && $tmp<=46317)
	$getpychar= "C";
	elseif($tmp>=46318 && $tmp<=46825)
	$getpychar= "D";
	elseif($tmp>=46826 && $tmp<=47009)
	$getpychar= "E";
	elseif($tmp>=47010 && $tmp<=47296)
	$getpychar= "F";
	elseif($tmp>=47297 && $tmp<=47613)
	$getpychar= "G";
	elseif($tmp>=47614 && $tmp<=48118)
	$getpychar= "H";
	elseif($tmp>=48119 && $tmp<=49061)
	$getpychar= "J";
	elseif($tmp>=49062 && $tmp<=49323)
	$getpychar= "K";
	elseif($tmp>=49324 && $tmp<=49895)
	$getpychar= "L";
	elseif($tmp>=49896 && $tmp<=50370)
	$getpychar= "M";
	elseif($tmp>=50371 && $tmp<=50613)
	$getpychar= "N";
	elseif($tmp>=50614 && $tmp<=50621)
	$getpychar= "O";
	elseif($tmp>=50622 && $tmp<=50905)
	$getpychar= "P";
	elseif($tmp>=50906 && $tmp<=51386)
	$getpychar= "Q";
	elseif($tmp>=51387 && $tmp<=51445)
	$getpychar= "R";
	elseif($tmp>=51446 && $tmp<=52217)
	$getpychar= "S";
	elseif($tmp>=52218 && $tmp<=52697)
	$getpychar= "T";
	elseif($tmp>=52698 && $tmp<=52979)
	$getpychar= "W";
	elseif($tmp>=52980 && $tmp<=53640)
	$getpychar= "X";
	elseif($tmp>=53689 && $tmp<=54480)
	$getpychar= "Y";
	elseif($tmp>=54481 && $tmp<=62289)
	$getpychar= "Z";
	else
	$getpychar=chr($tmp);

	return $getpychar;
}
/**
 * 汉字转拼音函数 GetPinyin
 * 示例: echo GetPinyin('罗大右');
 *
 * @access    public
 * @param     string  $str  字符串
 * @param     int  $ishead  是否为首字母
 * @param     int  $isclose  解析后是否释放资源
 * @return    string
 */
function GetPinyin($str,$ishead=0,$isclose=1){
	global $pinyins;
	$restr = "";
	$str = trim(iconv('UTF-8','GB2312',$str));
	$slen = strlen($str);
	if($slen<2) return $str;
	if(count($pinyins)==0){
		$fp = fopen(APPPATH."/helpers/data/pinyin.dat","r");
		while(!feof($fp)){
			$line = trim(fgets($fp));
			$pinyins[$line[0].$line[1]] = substr($line,3,strlen($line)-3);
		}
		fclose($fp);
	}
	for($i=0;$i<$slen;$i++){
		if(ord($str[$i])>0x80)
		{
			$c = $str[$i].$str[$i+1];
			$i++;
			if(isset($pinyins[$c])){
				if($ishead==0) $restr .= $pinyins[$c];
				else $restr .= $pinyins[$c][0];
			}else $restr .= "-";
		}else if( eregi("[a-z0-9]",$str[$i]) ){	$restr .= $str[$i]; }
		else{ $restr .= "-";  }
	}
	if($isclose==0) unset($pinyins);
	return $restr;
}
//读取友情链接
function read_link($chengshi_id){
	$filename = APPPATH."/controllers/batch/link_list.txt";
	$list=file($filename);
	foreach ( $list as $key => $item ){
		$arr=explode('|',$item);
		if ($chengshi_id==$arr[0]){
			$data['link_list'] .= $arr[1];
			$data['link']=explode("\n",$data['link_list']);
		}
	}
	return    $data;
}
//检测邮箱
function email_check($email){
	$array=explode('@',$email);
	$arremail=explode('.',$array[1]);
	if($arremail[1]==com||$arremail[1]==cn||$arremail[1]==net){
		return $email;
	}else{
		return '';
	}
}
//检测用户名
function name_check($name){
	if(!ereg("^[0-9a-zA-Z]{6,15}$",$name)){
		return '';
	}else{
		return $name;
	}
}
//检测邮箱
function mail_check($mail){
	if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@qq\.com$",$mail)){
		if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@163\.com$",$mail)){
			if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@126\.com$",$mail)){
				if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@sina\.com$",$mail)){
					if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@sohu\.com$",$mail)){
						if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@yahoo\.cn$",$mail)){
							if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@yahoo\.com\.cn$",$mail)){
								if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@yeah\.net$",$mail)){
									if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@tom\.com$",$mail)){
										if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@21cn\.com$",$mail)){
											if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@139\.com$",$mail)){
												if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@gmail\.com$",$mail)){
													if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@139\.com$",$mail)){
														if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@hotmail\.com$",$mail)){
															if(!ereg("^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@msn\.com$",$mail)){
																return '';
															}else{
																return $mail;
															}
														}else{
															return $mail;
														}
													}else{
														return $mail;
													}
												}else{
													return $mail;
												}
											}else{
												return $mail;
											}
										}else{
											return $mail;
										}
									}else{
										return $mail;
									}
								}else{
									return $mail;
								}
							}else{
								return $mail;
							}
						}else{
							return $mail;
						}
					}else{
						return $mail;
					}
				}else{
					return $mail;
				}
			}else{
				return $mail;
			}
		}else{
			return $mail;
		}
	}else{
		return $mail;
	}
}
//获取文件夹下所有图片名
function getdirfiles($path){
	$handle = opendir($path);
	while (false !== ($file = readdir($handle))) {
		list($filesname,$kzm)=explode(".",$file);//获取扩展名
		if($kzm=="gif" or $kzm=="jpg" or $kzm=="JPG") { //文件过滤
			if (!is_dir('./'.$file)) { //文件夹过滤
				$array[]=$file;//把符合条件的文件名存入数组
				$j++;//记录图片总张数
			}
		}
	}
}
//数字转换成汉字
function num2chs($num) {
	$char = array('星期', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日');
	$arr  = explode('.', $num);//分隔为整数和小数
	$num = strrev($arr[0]);//翻转整数位
	$len = strlen($num);
	for ($i = 0; $i < $len; $i++) {
		$int[$i] = $char[$num[$i]];//汉字数字
	}
	//小数的汉字
	$dec = isset($arr[1]) ? ','.str_replace(range(0, 9), $char, $arr[1]) : '';
	return implode("  ", array_reverse($int)).$dec;
}
function insert_file($file,$replace=''){
	global $Charset;
	$readfiles=read_file($file);
	if($replace){
		$readfiles=str_replace('$timestamp',"$timestamp",$readfiles);
	}
	$detail=explode("\n",$readfiles);
	$count=count($detail);
	for($j=0;$j<$count;$j++){
		$ck=substr($detail[$j],0,4);
		if( ereg("#",$ck)||ereg("--",$ck) ){
			continue;
		}
		$array[]=$detail[$j];
	}
	$read=implode("\n",$array);
	$sql=str_replace("\r",'',$read);
	$detail=explode(";\n",$sql);
	$count=count($detail);
	for($i=0;$i<$count;$i++){
		$sql=str_replace("\r",'',$detail[$i]);
		$sql=str_replace("\n",'',$sql);
		$sql=trim($sql);
		if($sql){
			if(eregi("CREATE TABLE",$sql)){
				$mysqlV=mysql_get_server_info();
				$sql=preg_replace("/DEFAULT CHARSET=([a-z0-9]+)/is","",$sql);
				$sql=preg_replace("/TYPE=MyISAM/is","ENGINE=MyISAM",$sql);
				if($mysqlV>'4.1'){
					$sql=str_replace("ENGINE=MyISAM"," ENGINE=MyISAM DEFAULT CHARSET=$Charset ",$sql);
				}
			}

			$query=mysql_query($sql);
			if (!$query) die("数据库出错:$sql");
			$check++;
		}
	}
	return $check;
}

function config_credit($credit_sum){
	if($credit_sum>=1 && $credit_sum<=10){
		$credit_level = 1;
	}elseif($credit_sum>=11 && $credit_sum<=65){
		$credit_level = 2;
	}elseif($credit_sum>=66 && $credit_sum<=165){
		$credit_level = 3;
	}elseif($credit_sum>=166 && $credit_sum<=320){
		$credit_level = 4;
	}elseif($credit_sum>=321 && $credit_sum<=500){
		$credit_level = 5;
	}elseif($credit_sum>=501 && $credit_sum<=1000){
		$credit_level = 6;
	}elseif($credit_sum>=1001){
		$credit_level = 7;
	}
	return $credit_level;
}
//信用等级计算
function credit_level($credit_sum){
	$credit_jibie = ceil(sqrt(($credit_sum + 20)/5)-2);
	return $credit_jibie;
}
//水印图片缩放
	function picchange(){
		$path="E:/APMServ5.2.6/www/htdocs/88tc/uploads/sale_diannaopeijian/25/2012/02";
		$handle = opendir($path);
		while (false !== ($file = readdir($handle))) {
			list($filesname,$kzm)=explode(".",$file);//获取扩展名
			if($kzm=="gif" or $kzm=="jpg" or $kzm=="JPG") { //文件过滤
				if (!is_dir('./'.$file)) { //文件夹过滤
					$array[]=$file;//把符合条件的文件名存入数组
					$j++;//记录图片总张数
				}
			}
		}
		//print_r($array);exit;
		for($i=0;$i<=$j;$i++){
			//echo $array[$i];exit;
			$a= $path.'/'.$array[$i];
			//echo $a;exit;
			$waterImage = $_SERVER ['DOCUMENT_ROOT'] . '/uploads/watermark.png';   //获得服务器水印文件位置
			$this->watermark_model->watermark($a,9);
			$this->watermark_model->setWaterImageInfo($waterImage,10);
			$this->watermark_model->makeWater("");
			$image=getimagesize($a);
			$image_width=$image[0];
			$image_height=$image[1];
			if ($image_width >= 800 || $image_height >= 800) {
				if ($image_width / $image_height > 800 / 800) {
					$thumb_a = $this->do_image ( '_b', $a, 800, 800 * ($image_height / $image_width) );
				} elseif ($image_width / $image_height <= 800 / 800) {
					$thumb_a = $this->do_image ( '_b', $a, 800 * ($image_width / $image_height), 800 );
				}
			} else {
				$thumb_a = $this->do_image ( '_b', $a, $image_width, $image_height );
			}
			//*******************************400*400 _l********************
			if ($image_width >= 400 || $image_height >= 400) {
				if ($image_width / $image_height > 400 / 400) {
					$thumb_a = $this->do_image ( '_m', $a, 400, 400 * ($image_height / $image_width) );
				} elseif ($image_width / $image_height <= 400 / 400) {
					$thumb_a = $this->do_image ( '_m', $a, 400 * ($image_width / $image_height), 400 );
				}
			} else {
				$thumb_a = $this->do_image ( '_m', $a, $image_width, $image_height );
			}

			//*******************************80,80 _l********************
			if ($image_width >= 80 || $image_height >= 80) {
				if ($image_width / $image_height > 80 / 80) {
					$thumb_a = $this->do_image ( '_s', $a, 80, 80 * ($image_height / $image_width) );
				} elseif ($image_width / $image_height <= 80 / 80) {
					$thumb_a = $this->do_image ( '_s', $a, 80 * ($image_width / $image_height), 80 );
				}
			} else {
				$thumb_a = $this->do_image ( '_s', $a, $image_width, $image_height );
			}
			//*******************************结束********************************************************************************
			//删除原图片开始
			$url = $a;
			unlink($url);}
			//删除原图片结束
			echo '完成';
	}
function config_credit_sum($credit_level,$lanmu_id,$type_id){
	if($credit_level==1 && ($lanmu_id==100 || $lanmu_id==300)){
		if($type_id ==310){
			$credit_tiao = 100;
		}else{
			$credit_tiao = 30;
		}
	}elseif($credit_level==2 && ($lanmu_id==100 || $lanmu_id==300)){
		if($type_id ==310){
			$credit_tiao = 150;
		}else{
			$credit_tiao = 50;
		}
	}elseif($credit_level==3 && ($lanmu_id==100 || $lanmu_id==300)){
		if($type_id ==310){
			$credit_tiao = 200;
		}else{
			$credit_tiao = 100;
		}
	}elseif($credit_level==4 && ($lanmu_id==100 || $lanmu_id==300)){
		if($type_id ==310){
			$credit_tiao = 300;
		}else{
			$credit_tiao = 150;
		}
	}elseif($credit_level==5 && ($lanmu_id==100 || $lanmu_id==300)){
		if($type_id ==310){
			$credit_tiao = 400;
		}else{
			$credit_tiao = 200;
		}
	}elseif($credit_level==6 && ($lanmu_id==100 || $lanmu_id==300)){
		if($type_id ==310){
			$credit_tiao = 500;
		}else{
			$credit_tiao = 300;
		}
	}elseif($credit_level==7 && ($lanmu_id==100 || $lanmu_id==300)){
		if($type_id ==310){
			$credit_tiao = 1000;
		}else{
			$credit_tiao = 400;
		}
	}
	if($lanmu_id==600||$lanmu_id==800||$lanmu_id==1000||$lanmu_id==800||$lanmu_id==1200||$lanmu_id==1300||$type_id==901||$type_id==902){
		$credit_tiao = 1;
	}
	if($credit_level==1 && $lanmu_id==900){
		if($type_id==905){
			$credit_tiao = 10;
		}elseif($type_id==903){
			$credit_tiao = 30;
		}elseif($type_id==904 || $type_id==906 || $type_id==907 || $type_id==908){
			$credit_tiao = 100;
		}
	}elseif($credit_level==2 && $lanmu_id==900){
		if($type_id==905){
			$credit_tiao = 10;
		}elseif($type_id==903){
			$credit_tiao = 30;
		}elseif($type_id==904 || $type_id==906 || $type_id==907 || $type_id==908){
			$credit_tiao = 150;
		}
	}elseif($credit_level==3 && $lanmu_id==900){
		if($type_id==905){
			$credit_tiao = 10;
		}elseif($type_id==903){
			$credit_tiao = 30;
		}elseif($type_id==904 || $type_id==906 || $type_id==907 || $type_id==908){
			$credit_tiao = 200;
		}
	}elseif($credit_level==4 && $lanmu_id==900){
		if($type_id==905){
			$credit_tiao = 10;
		}elseif($type_id==903){
			$credit_tiao = 30;
		}elseif($type_id==904 || $type_id==906 || $type_id==907 || $type_id==908){
			$credit_tiao = 300;
		}
	}elseif($credit_level==5 && $lanmu_id==900){
		if($type_id==905){
			$credit_tiao = 10;
		}elseif($type_id==903){
			$credit_tiao = 30;
		}elseif($type_id==904 || $type_id==906 || $type_id==907 || $type_id==908){
			$credit_tiao = 400;
		}
	}elseif($credit_level==6 && $lanmu_id==900){
		if($type_id==905||$type_id==903){
			$credit_tiao = 50;
		}elseif($type_id==904 || $type_id==906 || $type_id==907 || $type_id==908){
			$credit_tiao = 500;
		}
	}elseif($credit_level==7 && $lanmu_id==900){
		if($type_id==905||$type_id==903){
			$credit_tiao = 100;
		}elseif($type_id==904 || $type_id==906 || $type_id==907 || $type_id==908){
			$credit_tiao = 1000;
		}
	}if($lanmu_id==700){
		if($type_id==705){
			$credit_tiao = 10;
		}elseif($type_id==706){
			$credit_tiao = 1000;
		}elseif($credit_level==1 && ($type_id==701|| $type_id==702|| $type_id==703|| $type_id==704)){
			$credit_tiao = 30;
		}elseif($credit_level==2 && ($type_id==701|| $type_id==702|| $type_id==703|| $type_id==704)){
			$credit_tiao = 50;
		}elseif($credit_level==3 && ($type_id==701|| $type_id==702|| $type_id==703|| $type_id==704)){
			$credit_tiao = 70;
		}elseif($credit_level==4 && ($type_id==701|| $type_id==702|| $type_id==703|| $type_id==704)){
			$credit_tiao = 100;
		}elseif($credit_level==5 && ($type_id==701|| $type_id==702|| $type_id==703|| $type_id==704)){
			$credit_tiao = 120;
		}elseif($credit_level==6 && ($type_id==701|| $type_id==702|| $type_id==703|| $type_id==704)){
			$credit_tiao = 150;
		}elseif($credit_level==7 && ($type_id==701|| $type_id==702|| $type_id==703|| $type_id==704)){
			$credit_tiao = 200;
		}
	}
	if($lanmu_id==500){
		if($type_id==507||$type_id==508||$type_id==510){
			$credit_tiao = 10;
		}elseif($type_id==509){
			$credit_tiao = 20;
		}elseif($credit_level==1 && ($type_id==501|| $type_id==502|| $type_id==503|| $type_id==504|| $type_id==505|| $type_id==506)){
			$credit_tiao = 100;
		}elseif($credit_level==2 && ($type_id==501|| $type_id==502|| $type_id==503|| $type_id==504|| $type_id==505|| $type_id==506)){
			$credit_tiao = 150;
		}elseif($credit_level==3 && ($type_id==501|| $type_id==502|| $type_id==503|| $type_id==504|| $type_id==505|| $type_id==506)){
			$credit_tiao = 200;
		}elseif($credit_level==4 && ($type_id==501|| $type_id==502|| $type_id==503|| $type_id==504|| $type_id==505|| $type_id==506)){
			$credit_tiao = 300;
		}elseif($credit_level==5 && ($type_id==501|| $type_id==502|| $type_id==503|| $type_id==504|| $type_id==505|| $type_id==506)){
			$credit_tiao = 400;
		}elseif($credit_level==6 && ($type_id==501|| $type_id==502|| $type_id==503|| $type_id==504|| $type_id==505|| $type_id==506)){
			$credit_tiao = 500;
		}elseif($credit_level==7 && ($type_id==501|| $type_id==502|| $type_id==503|| $type_id==504|| $type_id==505|| $type_id==506)){
			$credit_tiao = 1000;
		}
	}
	if($lanmu_id==1100){
		if($type_id==1105){
			$credit_tiao = 30;
		}else{
			$credit_tiao = 10;
		}
	}
	if($lanmu_id==200 || $lanmu_id==400){
		if($credit_level==1 || $credit_level==2 || $credit_level==3){
			$credit_tiao = 50;
		}else{
			$credit_tiao = 100;
		}
	}
	if($credit_level==0){
		$credit_tiao = 0;
	}
	return $credit_tiao=$credit_tiao;
}
//数字变图片
function config_num_pic($num){
	header("Content-type: image/png");
	$rand_num=rand(0,255);
	$im = imagecreatetruecolor(110,15);
	$bg = imagecolorallocate($im,255,255,255);
	$te = imagecolorallocate($im,$rand_num,0,0);
	ImageFilledRectangle($im,0,0,110,15,$bg);  //填充背景
	imagestring($im,5,0,0,$num,$te);
	header("Content-type:image/png");
	imagePng($im);
	imagedestroy($im);
}
//数字变字母
function numToAbc($num,$type=0) {
	$map = array(
                '0'=>'a',
                '1'=>'b',
                '2'=>'c',
                '3'=>'d',
                '4'=>'e',
                '5'=>'f',
                '6'=>'g',
                '7'=>'h',
                '8'=>'i',
                '9'=>'j',
	);
	if($type){
		$map=array_flip($map);
	}
	$num = $num.'';
	$str = '';
	for($i = 0; $i<strlen($num); $i++) {
		$str .= $map[$num{$i}];
	}
	return $str;

}

/***********************友情链接开始***********************/
//友情链接分类
function Config_link_array($key){
	$app_link_name_class=array(
               "1" => "招聘求职类网站",
	           "2" => "房地产网站",
	           "3" => "交友网站",
	           "4" => "宠物类网站",
	           "5" => "车辆服务网站",
	           "6" => "二手买卖网站",
	           "7" => "教育培训网站",
	           "8" => "票务类网站",
	           "9" => "生活服务网站",
		       "10" => "商务服务网站",
	           "11" => "旅游类网站",
			   "12" => "招商加盟网站",
	           "13" => "其他类网站",
	);
	if($key){
		return $app_link_name_class[$key];
	}else{
		return $app_link_name_class;
	}
}
/***********************友情链接结束***********************/
function wenjian_pets($pets_category){
	if($pets_category==701){
		$wenjianjia='pets_dog';
	}if($pets_category==702){
		$wenjianjia='pets_cat';
	}if($pets_category==703){
		$wenjianjia='pets_birds';
	}if($pets_category==704){
		$wenjianjia='pets_food';
	}if($pets_category==705){
		$wenjianjia='pets_shop';
	}if($pets_category==706){
		$wenjianjia='pets_lingyang';
	}
	return $wenjianjia;
}

function wenjian_zhaoshang($zhaoshang_category){
	if($zhaoshang_category==1301){
		$wenjianjia='zhaoshang_canyin';
	}if($zhaoshang_category==1302){
		$wenjianjia='zhaoshang_fuzhuang';
	}if($zhaoshang_category==1303){
		$wenjianjia='zhaoshang_lipin';
	}if($zhaoshang_category==1304){
		$wenjianjia='zhaoshang_jixie';
	}if($zhaoshang_category==1305){
		$wenjianjia='zhaoshang_jiaju';
	}if($zhaoshang_category==1306){
		$wenjianjia='zhaoshang_jiaoyu';
	}if($zhaoshang_category==1307){
		$wenjianjia='zhaoshang_meirong';
	}if($zhaoshang_category==1308){
		$wenjianjia='zhaoshang_ganxi';
	}if($zhaoshang_category==1309){
		$wenjianjia='zhaoshang_jiancai';
	}if($zhaoshang_category==1310){
		$wenjianjia='zhaoshang_shoe';
	}if($zhaoshang_category==1311){
		$wenjianjia='zhaoshang_qita';
	}if($zhaoshang_category==1312){
		$wenjianjia='zhaoshang_xiangbao';
	}
	return $wenjianjia;
}

function wenjian_jianli_jianzhi($jianli_jianzhi_dalei){
	if($jianli_jianzhi_dalei==1){
		$wenjianjia='jianli_jianzhi_xuesheng';
	}if($jianli_jianzhi_dalei==2){
		$wenjianjia='jianli_jianzhi_jisuanji';
	}if($jianli_jianzhi_dalei==3){
		$wenjianjia='jianli_jianzhi_tuxing';
	}if($jianli_jianzhi_dalei==4){
		$wenjianjia='jianli_jianzhi_bianji';
	}if($jianli_jianzhi_dalei==5){
		$wenjianjia='jianli_jianzhi_cuxiao';
	}if($jianli_jianzhi_dalei==6){
		$wenjianjia='jianli_jianzhi_kefu';
	}if($jianli_jianzhi_dalei==7){
		$wenjianjia='jianli_jianzhi_caiwu';
	}if($jianli_jianzhi_dalei==8){
		$wenjianjia='jianli_jianzhi_jiaoyu';
	}if($jianli_jianzhi_dalei==9){
		$wenjianjia='jianli_jianzhi_canyin';
	}if($jianli_jianzhi_dalei==10){
		$wenjianjia='jianli_jianzhi_liyi';
	}if($jianli_jianzhi_dalei==11){
		$wenjianjia='jianli_jianzhi_jiagong';
	}if($jianli_jianzhi_dalei==12){
		$wenjianjia='jianli_jianzhi_qita';
	}
	return $wenjianjia;
}


function wenjian_jianli_quanzhi($jianli_quanzhi_type){
	if($jianli_quanzhi_type==1){
		$wenjianjia='jianli_quanzhi_xiaoshou';
	}if($jianli_quanzhi_type==2){
		$wenjianjia='jianli_quanzhi_kefu';
	}if($jianli_quanzhi_type==3){
		$wenjianjia='jianli_quanzhi_renshi';
	}if($jianli_quanzhi_type==4){
		$wenjianjia='jianli_quanzhi_caiwu';
	}if($jianli_quanzhi_type==5){
		$wenjianjia='jianli_quanzhi_pugong';
	}if($jianli_quanzhi_type==6){
		$wenjianjia='jianli_quanzhi_canyin';
	}if($jianli_quanzhi_type==7){
		$wenjianjia='jianli_quanzhi_meirong';
	}if($jianli_quanzhi_type==8){
		$wenjianjia='jianli_quanzhi_lingshou';
	}if($jianli_quanzhi_type==9){
		$wenjianjia='jianli_quanzhi_jiazheng';
	}if($jianli_quanzhi_type==10){
		$wenjianjia='jianli_quanzhi_siji';
	}if($jianli_quanzhi_type==11){
		$wenjianjia='jianli_quanzhi_shichang';
	}if($jianli_quanzhi_type==12){
		$wenjianjia='jianli_quanzhi_guanggao';
	}if($jianli_quanzhi_type==13){
		$wenjianjia='jianli_quanzhi_jiaoyu';
	}if($jianli_quanzhi_type==14){
		$wenjianjia='jianli_quanzhi_falv';
	}if($jianli_quanzhi_type==15){
		$wenjianjia='jianli_quanzhi_fanyi';
	}if($jianli_quanzhi_type==16){
		$wenjianjia='jianli_quanzhi_bianji';
	}if($jianli_quanzhi_type==17){
		$wenjianjia='jianli_quanzhi_qiche';
	}if($jianli_quanzhi_type==18){
		$wenjianjia='jianli_quanzhi_jisuanji';
	}if($jianli_quanzhi_type==19){
		$wenjianjia='jianli_quanzhi_jianzhu';
	}if($jianli_quanzhi_type==20){
		$wenjianjia='jianli_quanzhi_jinrong';
	}if($jianli_quanzhi_type==21){
		$wenjianjia='jianli_quanzhi_yiliao';
	}if($jianli_quanzhi_type==22){
		$wenjianjia='jianli_quanzhi_dianzi';
	}if($jianli_quanzhi_type==23){
		$wenjianjia='jianli_quanzhi_baoxian';
	}if($jianli_quanzhi_type==24){
		$wenjianjia='jianli_quanzhi_maoyi';
	}if($jianli_quanzhi_type==25){
		$wenjianjia='jianli_quanzhi_cangchu';
	}if($jianli_quanzhi_type==26){
		$wenjianjia='jianli_quanzhi_yingshi';
	}if($jianli_quanzhi_type==27){
		$wenjianjia='jianli_quanzhi_qita';
	}
	return $wenjianjia;
}

/***********************友情链接结束***********************/
/*******************教育图片文件夹位置****************/
function get_education_image_dir($education_category){
	if($education_category==1001){
		$upload_dir = 'education_1001';

	}else if($education_category==1002){
		$upload_dir = 'education_1002';
			
	}else if($education_category==1003){
		$upload_dir = 'education_1003';
			
	}else if($education_category==1004){
		$upload_dir = 'education_1004';
			
	}else if($education_category==1005){
		$upload_dir = 'education_1005';
			
	}else if($education_category==1006){
		$upload_dir = 'education_1006';
			
	}else if($education_category==1007){
		$upload_dir = 'education_1007';
			
	}else if($education_category==1008){
		$upload_dir = 'education_1008';
			
	}else if($education_category==1009){
		$upload_dir = 'education_1009';
			
	}else if($education_category==1010){
		$upload_dir = 'education_1010';
			
	}else if($education_category==1011){
		$upload_dir = 'education_1011';
	}

	return $upload_dir;
}
/*********************结束**********************/
/*******************旅游图片文件夹位置****************/
function get_travel_image_dir($travel_category){
	if($travel_category==1201){
		$upload_dir = 'travel_1201';
	}else if($travel_category==1202){
		$upload_dir = 'travel_1202';
	}else if($travel_category==1203){
		$upload_dir = 'travel_1203';
	}else if($travel_category==1204){
		$upload_dir = 'travel_1204';
	}else if($travel_category==1205){
		$upload_dir = 'travel_1205';
	}else if($travel_category==1206){
		$upload_dir = 'travel_1206';
	}else if($travel_category==1207){
		$upload_dir = 'travel_1207';
	}else if($travel_category==1208){
		$upload_dir = 'travel_1208';
	}

	return $upload_dir;
}
/*********************结束**********************/
function js_unescape($str)
{
	$ret = '';
	$len = strlen($str);
	for ($i = 0; $i < $len; $i++)
	{
		if ($str[$i] == '%' && $str[$i+1] == 'u')
		{
			$val = hexdec(substr($str, $i+2, 4));
			if ($val < 0x7f) $ret .= chr($val);
			else if($val < 0x800) $ret .= chr(0xc0|($val>>6)).chr(0x80|($val&0x3f));
			else $ret .= chr(0xe0|($val>>12)).chr(0x80|(($val>>6)&0x3f)).chr(0x80|($val&0x3f));
			$i += 5;
		}
		else if ($str[$i] == '%')
		{
			$ret .= urldecode(substr($str, $i, 3));
			$i += 2;
		}
		else $ret .= $str[$i];
	}
	return $ret;
}

//站内信
function Config_message_read_array($key){
	$app_message_read_name_class=array(
				"2" => "已读",
                "1" => "未读",
	);
	if($key){
		return $app_message_read_name_class[$key];
	}else{
		return $app_message_read_name_class;
	}
}
function Config_manager_user_array($key){
	$app_manager_user_name_class=array(
				"1" => "房产城市通用户",
                "2" => "生活服务城市通用户",
	            "3" => "招聘城市通用户",
	            "4" => "宠物城市通用户",
	            "5" => "普通用户",
	);
	if($key){
		return $app_manager_user_name_class[$key];
	}else{
		return $app_manager_user_name_class;
	}
}
function Config_message_reply_array($key){
	$app_message_reply_name_class=array(
				"2" => "未回复",
                "1" => "已回复",
	);
	if($key){
		return $app_message_reply_name_class[$key];
	}else{
		return $app_message_reply_name_class;
	}
}
function Config_test_array($key){
	$app_test_name_class=array(
				"0" => "37",
                "1" => "33",
	);
	if($key){
		return $app_test_name_class[$key];
	}else{
		return $app_test_name_class;
	}
}
function share($city_name,$category,$title){
	$share_content='
    <div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare">
    <a class="bds_qzone">QQ空间</a>
    <a class="bds_tsina">新浪微博</a>
    <a class="bds_tqq">腾讯微博</a>
    <a class="bds_renren">人人网</a>
    <a class="bds_hi">百度空间</a>
    <span class="bds_more">更多</span>
	</div>
	<script type="text/javascript" id="bdshare_js" data="type=tools&mini=1" ></script> 
	<script type="text/javascript" id="bdshell_js"></script> 
	<script type="text/javascript">
	';
	//在这里定义bds_config
	$share_content.="var bds_config = {'bdText':";
	$share_content.="'#88同城#'$city_name'#'$category'#'$title";
	$share_content.='};
		document.getElementById("bdshell_js").src = "http://share.baidu.com/static/js/shell_v2.js?t=" + new Date().getHours();
	   </script>
   ';
	echo $share_content;
}

function pets_price($pets_price){
	if($pets_price==90){
		$price='100元以下';
	}if($pets_price==150){
		$price='100-200元';
	}if($pets_price==300){
		$price='200-500元';
	}if($pets_price==700){
		$price='500-1000元';
	}if($pets_price==1500){
		$price='1000-2000元';
	}if($pets_price==3000){
		$price='2000-3500元';
	}if($pets_price==4000){
		$price='3500元以上';
	}
	return $price;
}
function pets_price1($pets_price){
	if($pets_price==30){
		$price='50元以下';
	}if($pets_price==80){
		$price='50-100元';
	}if($pets_price==150){
		$price='100-200元';
	}if($pets_price==300){
		$price='200-400元';
	}if($pets_price==600){
		$price='400-800元';
	}if($pets_price==1000){
		$price='800-1200元';
	}if($pets_price==2000){
		$price='1200元以上';
	}
	return $price;
}
//二分插入   用于 将单个$b插入有序数组$a，此处返回插入位置
function binary_search($a,$b){
	$len=count($a);
	$left=0;$right=$len-1;
	while($left<=$right){
		$mid= (int)(($left+$right)/2);
		if($b['update_time']==$a[$mid]['update_time']){
			return $mid;
		}
		if($b['update_time']>$a[$mid]['update_time']){
			$left=$mid+1;
		}
		if($b['update_time']<$a[$mid]['update_time']){
			$right=$mid-1;
		}

	}
	return $left;
}
//加油站分类
function Config_gasstation_array($key){
	$app_gasstation_name_class=array(
		       "1" => "中国石化加油站",
               "2" => "中国石油加油站",
               "3" => "壳牌",
			   "4" => "东方",
			   "5" => "道达尔",
			   "6" => "加油加气站",	
	           "7" => "加气站",			   
	);
	if($key){
		return $app_gasstation_name_class[$key];
	}else{
		return $app_gasstation_name_class;
	}
}
//超市分了
function Config_supermarket_array($key){
	$app_supermarket_name_class=array(
               "1" => "家乐福",
			   "2" => "沃尔玛",
			   "3" => "华润超市",
			   "4" => "华联超市",	
	           "5" => "京客隆",	
	           "6" => "万客隆",
	           "7" => "易初莲花",
	           "8" => "屈臣氏",

	);
	if($key){
		return $app_supermarket_name_class[$key];
	}else{
		return $app_supermarket_name_class;
	}
}
//医院分类
function Config_hospital_array($key){
	$app_hospital_name_class=array(
		       "1" => "综合医院",
               "2" => "三级甲等医院",
               "3" => "卫生院",
			   "4" => "整形美容",
			   "5" => "口腔医院",
			   "6" => "眼科医院",	
	           "7" => "耳鼻喉医院",
			   "8" => "胸科医院 ",
	           "9" => "骨科医院",
	           "10" => "肿瘤医院",
	           "11" => "脑科医院",
	           "12" => "妇科医院",
	           "13" => "精神病医院",
	           "14" => "传染病医院",
	           "15" => "诊所",
	);
	if($key){
		return $app_hospital_name_class[$key];
	}else{
		return $app_hospital_name_class;
	}
}
//银行分类
function Config_bank_array($key){
	$app_bank_name_class=array(
		       "1" => "中国银行",
               "2" => "工商银行",
			   "3" => "招商银行",
			   "4" => "交通银行",	
			   "5" => "建设银行",
	           "6" => "农业银行",
	           "7" => "中信银行",	
	           "8" => "华夏银行",
               "9" => "北京银行",
			   "10" => "民生银行",	
	           "11" => "光大银行",
	           "12" => "浦发银行",
	           "13" => "广发银行",
	           "14" => "兴业银行",
	           "15" => "外资银行",
	           "16" => "邮政储蓄银行",
	);
	if($key){
		return $app_bank_name_class[$key];
	}else{
		return $app_bank_name_class;
	}
}
//宠物医院分类
function Config_chongwuyiyuan_array($key){
	$app_chongwuyiyuan_name_class=array(
		       "1" => "宠物诊所",
               "2" => "兽医院",
	);
	if($key){
		return $app_chongwuyiyuan_name_class[$key];
	}else{
		return $app_chongwuyiyuan_name_class;
	}
}
//水电营业厅分类
function Config_shuidian_array($key){
	$app_shuidian_name_class=array(
		       "1" => "自来水营业厅",
               "2" => "电力营业厅",
	);
	if($key){
		return $app_shuidian_name_class[$key];
	}else{
		return $app_shuidian_name_class;
	}
}
//宠物医院分类
function Config_complaint_array($key){
	$app_complaint_name_class=array(
		       "1" => "联系电话虚假",
               "2" => "虚假、违法信息",
	);
	if($key){
		return $app_complaint_name_class[$key];
	}else{
		return $app_complaint_name_class;
	}
}
function Config_advice_array($key){
	$advice_array = array(
	            "1" => "其他" ,
				"100" => "房屋信息" , 
				"200" => "免费招聘" ,
		        "300" => "二手市场" ,
		        "400" => "求职简历" ,
		        "500" => "车辆买卖与服务" ,
				"600" => "生活服务" ,
				"700" => "宠物" ,
				"800" => "商务服务" ,
				"900" => "票务/优惠打折" ,
				"1000" => "教育培训" ,
				"1100" => "交友征婚" ,
				"1200" => "旅游/酒店/签证" ,
				"1300" => "招商加盟" ,

	);
	if($key){
		return $advice_array[$key];
	}else{
		return $advice_array;
	}

}



//广告位管理  $a 广告类型 1百度     2google  $b 不同类型
function Config_ad_js($a,$b){
	if($a==1){
		switch ($b){
			case 1:$rs='<script type="text/javascript">/*liebiao960*90，创建于2012-3-20*/ var cpro_id = "u814929";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 2:$rs='<script type="text/javascript">/*整套出租列表960*60，创建于2012-3-18*/ var cpro_id = "u812163";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 3:$rs='<script type="text/javascript">/*整套出租详细728*90，创建于2012-3-18*/ var cpro_id = "u812164";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 4:$rs='<script type="text/javascript">/*360*300，创建于2012-3-19*/ var cpro_id = "u812783";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 5:$rs='<script type="text/javascript">/*整套出租详细右上120*240，创建于2012-3-18*/ var cpro_id = "u812166";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 6:$rs='<script type="text/javascript">/*250*250，创建于2012-3-19*/ var cpro_id = "u812815";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 7:$rs='<script type="text/javascript">/*336*280，创建于2012-3-19*/ var cpro_id = "u812920";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 8:$rs='<script type="text/javascript">/*新闻内容页160*600，创建于2012-3-20*/ var cpro_id = "u814147";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 9:$rs='<script type="text/javascript">/*news 160*600，创建于2012-3-20*/ var cpro_id = "u814163";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 10:$rs='<script type="text/javascript">/*城市切换300*250，创建于2012-3-20*/ var cpro_id = "u814190";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 11:$rs='<script type="text/javascript">/*详细 右下250*250，创建于2012-3-20*/ var cpro_id = "u814680";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 12:$rs='<script type="text/javascript">/*详细图片下960*90，创建于2012-3-20*/ var cpro_id = "u814648";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 13:$rs='<script type="text/javascript">/*728*90，创建于2012-3-20*/ var cpro_id = "u814931";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
		}
	}elseif ($a==2){
		switch ($b){
			case 1:$rs='<script type="text/javascript"><!--
					google_ad_client = "ca-pub-2086995005611015";
					/* 整套出租列表下 */
					google_ad_slot = "8108333179";
					google_ad_width = 728;
					google_ad_height = 90;
					//-->
					</script>
					<script type="text/javascript"
					src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
					</script>';break;
			case 2:$rs='<script type="text/javascript"><!--
						google_ad_client = "ca-pub-2086995005611015";
						/* 整套出租列表 */
						google_ad_slot = "6925957578";
						google_ad_width = 728;
						google_ad_height = 90;
						//-->
						</script>
						<script type="text/javascript"
						src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
						</script>';break;
			case 3:$rs='<script type="text/javascript"><!--
						google_ad_client = "ca-pub-2086995005611015";
						/* 整套出租详细1 */
						google_ad_slot = "9700657615";
						google_ad_width = 728;
						google_ad_height = 90;
						//-->
						</script>
						<script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';break;
			case 4:$rs='<script type="text/javascript">/*整套出租详细500*200，创建于2012-3-19*/ var cpro_id = "u812692";</script><script src="http://cpro.baidu.com/cpro/ui/c.js" type="text/javascript"></script>';break;
			case 5:$rs='<script type="text/javascript"><!--
						google_ad_client = "ca-pub-2086995005611015";
						/* 整套出租详细右下 */
						google_ad_slot = "6536366242";
						google_ad_width = 120;
						google_ad_height = 240;
						//-->
						</script>
						<script type="text/javascript"
						src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
						</script>';break;
			case 6:$rs='<script type="text/javascript"><!--
						google_ad_client = "ca-pub-2086995005611015";
						/* 整套出租详细右下 */
						google_ad_slot = "6536366242";
						google_ad_width = 120;
						google_ad_height = 240;
						//-->
						</script>
						<script type="text/javascript"
						src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
						</script>';break;
						
		}
	}
	return $rs;
}

